home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / SPMATE13.ZIP / SAVEFILE.FR$ / savefile.frm
Text File  |  1993-07-09  |  5KB  |  190 lines

  1. VERSION 2.00
  2. Begin Form SaveFile 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Enter File Name for Save"
  5.    Height          =   3480
  6.    Icon            =   0
  7.    Left            =   960
  8.    LinkMode        =   1  'Source
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3105
  11.    ScaleWidth      =   4830
  12.    Top             =   1200
  13.    Width           =   4920
  14.    Begin CommandButton Command2 
  15.       Caption         =   "Cancel"
  16.       Height          =   375
  17.       Left            =   3480
  18.       TabIndex        =   7
  19.       Top             =   1800
  20.       Width           =   1095
  21.    End
  22.    Begin DriveListBox Drive1 
  23.       Height          =   315
  24.       Left            =   2025
  25.       TabIndex        =   0
  26.       Top             =   1560
  27.       Width           =   1215
  28.    End
  29.    Begin CommandButton Command1 
  30.       Caption         =   "OK"
  31.       Default         =   -1  'True
  32.       Height          =   375
  33.       Left            =   3465
  34.       TabIndex        =   6
  35.       Top             =   1305
  36.       Width           =   1095
  37.    End
  38.    Begin DirListBox Dir1 
  39.       Height          =   1815
  40.       Left            =   240
  41.       TabIndex        =   1
  42.       Top             =   1080
  43.       Width           =   1575
  44.    End
  45.    Begin TextBox Text1 
  46.       Height          =   315
  47.       Left            =   1200
  48.       TabIndex        =   2
  49.       Text            =   " "
  50.       Top             =   240
  51.       Width           =   3015
  52.    End
  53.    Begin Label Label5 
  54.       AutoSize        =   -1  'True
  55.       Caption         =   "Drives:"
  56.       Height          =   195
  57.       Left            =   2025
  58.       TabIndex        =   5
  59.       Top             =   1335
  60.       Width           =   615
  61.    End
  62.    Begin Label Label1 
  63.       AutoSize        =   -1  'True
  64.       Height          =   195
  65.       Left            =   2160
  66.       TabIndex        =   3
  67.       Top             =   855
  68.       Width           =   2055
  69.    End
  70.    Begin Label Label4 
  71.       AutoSize        =   -1  'True
  72.       Caption         =   "Directories:"
  73.       Height          =   195
  74.       Left            =   240
  75.       TabIndex        =   4
  76.       Top             =   825
  77.       Width           =   990
  78.    End
  79.    Begin Label Label2 
  80.       AutoSize        =   -1  'True
  81.       Caption         =   "File Name:"
  82.       Height          =   195
  83.       Left            =   240
  84.       TabIndex        =   8
  85.       Top             =   240
  86.       Width           =   915
  87.    End
  88. End
  89. Const TEXTFLAG = 0
  90. Const DIRFLAG = 1
  91.  
  92. Dim SelectFlag As Integer
  93.  
  94. Sub Command1_Click ()
  95.    On Error GoTo ErrorTrap
  96.  
  97.    If SelectFlag = DIRFLAG Then
  98.       Dir1.Path = Dir1.List(Dir1.ListIndex)
  99.       Dir1_Change
  100.       SelectFlag = TEXTFLAG
  101.    ElseIf InStr(Text1.Text, "\") Then
  102.       Tmp$ = Text1.Text
  103.       Do Until Right$(Tmp$, 1) = "\"
  104.          Tmp$ = Left$(Tmp$, Len(Tmp$) - 1)
  105.       Loop
  106.       If Len(Tmp$) > 3 Then
  107.          Tmp$ = Left$(Tmp$, Len(Tmp$) - 1)
  108.       End If
  109.       Dir1.Path = Tmp$
  110.       Do
  111.          Text1.Text = Mid$(Text1.Text, InStr(Text1.Text, "\") + 1)
  112.       Loop While InStr(Text1.Text, "\")
  113.    Else
  114.       Tmp$ = LTrim$(RTrim$(Text1.Text))
  115.       If Tmp$ <> "" Then
  116.          If Right$(Dir1.Path, 1) = "\" Then
  117.             FullFilePath = Dir1.Path + Tmp$
  118.          Else
  119.             FullFilePath = Dir1.Path + "\" + Tmp$
  120.          End If
  121.          Unload SaveFile
  122.       Else
  123.          Beep
  124.          Text1.SetFocus
  125.       End If
  126.    End If
  127.  
  128.    Exit Sub
  129.  
  130. ErrorTrap:
  131.    Beep
  132.    Resume Next
  133. End Sub
  134.  
  135. Sub Command2_Click ()
  136.    Unload SaveFile
  137. End Sub
  138.  
  139. Sub Dir1_Change ()
  140.    FillLabel1
  141.    Drive1.Drive = Dir1.Path
  142.    SelectFlag = DIRFLAG
  143. End Sub
  144.  
  145. Sub Dir1_Click ()
  146.    SelectFlag = DIRFLAG
  147. End Sub
  148.  
  149. Sub Drive1_Change ()
  150.    Dir1.Path = Drive1.Drive
  151.    SelectFlag = DIRFLAG
  152. End Sub
  153.  
  154. Sub FillLabel1 ()
  155.    Label1.Caption = Dir1.Path
  156.    If Label1.Width > 2055 Then
  157.       a$ = Left$(Dir1.Path, 3)
  158.       b$ = Mid$(Dir1.Path, 4)
  159.       Do While InStr(b$, "\")
  160.          b$ = Mid$(b$, InStr(b$, "\") + 1)
  161.       Loop
  162.       Label1.Caption = a$ + "...\" + b$
  163.    End If
  164. End Sub
  165.  
  166. Sub Form_Load ()
  167.    SaveFile.Left = (Screen.Width - SaveFile.Width) / 2
  168.    SaveFile.Top = (Screen.Height - SaveFile.Height) / 2
  169.  
  170.    If FullFilePath <> "" Then
  171.       Tmp$ = FullFilePath
  172.       Do Until Right$(Tmp$, 1) = "\"
  173.          Tmp$ = Left$(Tmp$, Len(Tmp$) - 1)
  174.       Loop
  175.       Tmp$ = Tmp$ + WILDCARD$
  176.    End If
  177.  
  178.    FillLabel1
  179.    SelectFlag = TEXTFLAG
  180. End Sub
  181.  
  182. Sub Form_Resize ()
  183.    Text1.SetFocus
  184. End Sub
  185.  
  186. Sub Text1_Change ()
  187.    SelectFlag = TEXTFLAG
  188. End Sub
  189.  
  190.